<?php
class Result {
	public $status = 1;
	public $data = NULL;
	public $text = '';
	public $callback = 'callback';
	
	public function __construct($registry) {
		$this->response = $registry->get('response');
	}
	
	public function jsonp_get() {
		$this->response->addHeader('Content-Type: text/javascript; charset=utf-8');
		return $this->callback . '(' . json_encode(array('data' => $this->data, 'text' => $this->text, 'status' => $this->status)) . ')';
	}
	
	public function json_get() {
		return json_encode(array('data' => $this->data, 'text' => $this->text, 'status' => $this->status));
	}
}
?>